package com.biodiv.community.converter.convert;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.TypeReference;
import org.mapstruct.Named;

import java.util.List;

/**
 * @author: tianquan
 * @date: 2025-06-28  21:33
 */
public class BaseMapping {

    @Named("str2List")
    public static List<String> str2List(String str) {
        if (str != null) {
            return JSON.parseObject(str, new TypeReference<>() {
            });
        }
        return null;
    }

    @Named("list2Str")
    public static String list2Str(List<String> list) {
        if (list != null) {
            return JSON.toJSONString(list);
        }
        return null;
    }

}
